import request from '@/utils/request'

export function getGroupList(scope) {
  return request({
    url: `/kd_manage/perm/group/${scope}/list`,
    method: 'get'
  })
}

export function addGroup(scope, data) {
  return request({
    url: `/kd_manage/perm/group/${scope}/add`,
    method: 'post',
    data: data
  })
}

export function updateGroup(scope, data) {
  return request({
    url: `/kd_manage/perm/group/${scope}/update`,
    method: 'post',
    data: data
  })
}

export function deleteGroup(scope, groupId) {
  return request({
    url: `/kd_manage/perm/group/${scope}/delete`,
    method: 'post',
    data: { id: groupId }
  })
}

export function getGroupPermList(scope, groupId) {
  return request({
    url: `/kd_manage/perm/${scope}/page`,
    method: 'get',
    params: { groupId: groupId }
  })
}

export function queryGroupPermList(scope, data) {
  return request({
    url: `/kd_manage/perm/${scope}/page`,
    method: 'post',
    data: data
  })
}

export function addGroupPerm(scope, data) {
  return request({
    url: `/kd_manage/perm/${scope}/add`,
    method: 'post',
    data: data
  })
}

export function updateGroupPerm(scope, data) {
  return request({
    url: `/kd_manage/perm/${scope}/update`,
    method: 'post',
    data: data
  })
}

export function getPerm(scope, permId) {
  return request({
    url: `/kd_manage/perm/${scope}/info`,
    method: 'get',
    params: { permId: permId }
  })
}

export function deleteGroupPerm(scope, permId) {
  return request({
    url: `/kd_manage/perm/${scope}/delete`,
    method: 'post',
    data: { id: permId }
  })
}

export function getGroupPerms(scope) {
  return request({
    url: `/kd_manage/perm/group/${scope}/getGroupPerms`,
    method: 'get'
  })
}
